<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>BOOST_&lt;level&gt;_EQUAL_COLLECTIONS</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Boost.Test">
<link rel="up" href="../testing_tool_ref.html" title="Reference API for writing tests">
<link rel="prev" href="assertion_boost_level_eq.html" title="BOOST_&lt;level&gt;_EQUAL">
<link rel="next" href="assertion_boost_level_close.html" title="BOOST_&lt;level&gt;_CLOSE">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="assertion_boost_level_eq.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../testing_tool_ref.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="assertion_boost_level_close.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="boost_test.utf_reference.testing_tool_ref.assertion_boost_level_eq_collections"></a><a class="link" href="assertion_boost_level_eq_collections.html" title="BOOST_&lt;level&gt;_EQUAL_COLLECTIONS"><code class="computeroutput"><span class="identifier">BOOST_</span><span class="special">&lt;</span><span class="identifier">level</span><span class="special">&gt;</span><span class="identifier">_EQUAL_COLLECTIONS</span></code></a>
</h4></div></div></div>
<pre class="programlisting"><span class="identifier">BOOST_WARN_EQUAL_COLLECTIONS</span><span class="special">(</span><span class="identifier">left_begin</span><span class="special">,</span> <span class="identifier">left_end</span><span class="special">,</span> <span class="identifier">right_begin</span><span class="special">,</span> <span class="identifier">right_end</span><span class="special">);</span>
<span class="identifier">BOOST_CHECK_EQUAL_COLLECTIONS</span><span class="special">(</span><span class="identifier">left_begin</span><span class="special">,</span> <span class="identifier">left_end</span><span class="special">,</span> <span class="identifier">right_begin</span><span class="special">,</span> <span class="identifier">right_end</span><span class="special">);</span>
<span class="identifier">BOOST_REQUIRE_EQUAL_COLLECTIONS</span><span class="special">(</span><span class="identifier">left_begin</span><span class="special">,</span> <span class="identifier">left_end</span><span class="special">,</span> <span class="identifier">right_begin</span><span class="special">,</span> <span class="identifier">right_end</span><span class="special">);</span>
</pre>
<p>
          These tools are used to perform an element by element comparison of two
          collections. They print all mismatched positions, collection elements at
          these positions and check that the collections have the same size. The
          first two parameters designate begin and end of the first collection. The
          two last parameters designate begin and end of the second collection.
        </p>
<h6>
<a name="boost_test.utf_reference.testing_tool_ref.assertion_boost_level_eq_collections.h0"></a>
          <span class="phrase"><a name="boost_test.utf_reference.testing_tool_ref.assertion_boost_level_eq_collections.example_descr"></a></span><a class="link" href="assertion_boost_level_eq_collections.html#boost_test.utf_reference.testing_tool_ref.assertion_boost_level_eq_collections.example_descr">Example:
          BOOST_&lt;level&gt;_EQUAL_COLLECTIONS usage</a>
        </h6>
<div class="informaltable"><table class="table">
<colgroup><col></colgroup>
<thead><tr><th>
                  <p>
                    Code
                  </p>
                </th></tr></thead>
<tbody><tr><td>
<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="preprocessor">#define</span> <span class="identifier">BOOST_TEST_MODULE</span> <span class="identifier">example</span>
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">test</span><span class="special">/</span><span class="identifier">included</span><span class="special">/</span><span class="identifier">unit_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>

<span class="identifier">BOOST_AUTO_TEST_CASE</span><span class="special">(</span> <span class="identifier">test</span> <span class="special">)</span>
<span class="special">{</span>
  <span class="keyword">int</span> <span class="identifier">col1</span> <span class="special">[]</span> <span class="special">=</span> <span class="special">{</span> <span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span> <span class="number">4</span><span class="special">,</span> <span class="number">5</span><span class="special">,</span> <span class="number">6</span><span class="special">,</span> <span class="number">7</span> <span class="special">};</span>
  <span class="keyword">int</span> <span class="identifier">col2</span> <span class="special">[]</span> <span class="special">=</span> <span class="special">{</span> <span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">,</span> <span class="number">4</span><span class="special">,</span> <span class="number">4</span><span class="special">,</span> <span class="number">5</span><span class="special">,</span> <span class="number">7</span><span class="special">,</span> <span class="number">7</span> <span class="special">};</span>

  <span class="identifier">BOOST_CHECK_EQUAL_COLLECTIONS</span><span class="special">(</span> <span class="identifier">col1</span><span class="special">,</span> <span class="identifier">col1</span><span class="special">+</span><span class="number">7</span><span class="special">,</span> <span class="identifier">col2</span><span class="special">,</span> <span class="identifier">col2</span><span class="special">+</span><span class="number">7</span> <span class="special">);</span>
<span class="special">}</span>
</pre>
                </td></tr></tbody>
</table></div>
<div class="informaltable"><table class="table">
<colgroup><col></colgroup>
<thead><tr><th>
                  <p>
                    Output
                  </p>
                </th></tr></thead>
<tbody><tr><td>
<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="special">&gt;</span> <span class="identifier">example</span>
<span class="identifier">Running</span> <span class="number">1</span> <span class="identifier">test</span> <span class="keyword">case</span><span class="special">...</span>
<span class="identifier">test</span><span class="special">.</span><span class="identifier">cpp</span><span class="special">(</span><span class="number">11</span><span class="special">):</span> <span class="identifier">error</span> <span class="identifier">in</span> <span class="string">"test"</span><span class="special">:</span> <span class="identifier">check</span> <span class="special">{</span> <span class="identifier">col1</span><span class="special">,</span> <span class="identifier">col1</span><span class="special">+</span><span class="number">7</span> <span class="special">}</span> <span class="special">==</span> <span class="special">{</span> <span class="identifier">col2</span><span class="special">,</span> <span class="identifier">col2</span><span class="special">+</span><span class="number">7</span> <span class="special">}</span> <span class="identifier">has</span> <span class="identifier">failed</span><span class="special">.</span>
<span class="identifier">Mismatch</span> <span class="identifier">in</span> <span class="identifier">a</span> <span class="identifier">position</span> <span class="number">2</span><span class="special">:</span> <span class="number">3</span> <span class="special">!=</span> <span class="number">4</span>
<span class="identifier">Mismatch</span> <span class="identifier">in</span> <span class="identifier">a</span> <span class="identifier">position</span> <span class="number">5</span><span class="special">:</span> <span class="number">6</span> <span class="special">!=</span> <span class="number">7</span>

<span class="special">***</span> <span class="number">1</span> <span class="identifier">failures</span> <span class="identifier">is</span> <span class="identifier">detected</span> <span class="identifier">in</span> <span class="identifier">test</span> <span class="identifier">suite</span> <span class="string">"example"</span>
</pre>
                </td></tr></tbody>
</table></div>
<p>
          See also:
        </p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
              <a class="link" href="assertion_boost_level_eq.html" title="BOOST_&lt;level&gt;_EQUAL"><code class="computeroutput"><span class="identifier">BOOST_</span><span class="special">&lt;</span><span class="identifier">level</span><span class="special">&gt;</span><span class="identifier">_EQUAL</span></code></a>
            </li></ul></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2001-2022 Boost.Test contributors<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="assertion_boost_level_eq.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../testing_tool_ref.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="assertion_boost_level_close.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
